<table class="grid-view">
    <tr>
        <?php foreach($this->columns as $name => $column): ?>
            <th><?php echo $column['label'] ?></th>
            <?php endforeach; ?>
    </tr>

    <?php if(count($this->data) == 0): ?>
        <tr>
            <td colspan="<?php echo count($this->columns) ?>"><?php echo $this->messageEmpty ?></td>
        </tr>
        <?php else: ?>            
        <?php foreach($this->data as $key => $row): ?>
            <tr>
                <?php foreach($this->columns as $name => $column):?>
                    <!-- show no -->
                    <?php if($name == 'NO'): ?>
                        <td><?php echo $key+1; ?></td>
                        <?php else: ?>     

                        <!-- show column type -->
                        <?php if(isset($column['options']['type'])): ?>
                            <td>

                                <!-- Set action for column -->
                                <?php if($column['options']['type'] == 'ACTION'): ?>
                                    <?php if(isset($column['elements'])): ?>
                                        <?php foreach($column['elements'] as $element): ?>    
                                            <a href="<?php eval(" echo '". $element->options['link']."';"); ?>"><span><?php echo $element->name ?></span></a>
                                            <?php endforeach; ?>
                                        <?php endif; ?>
                                <?php endif; ?>


                    </td>
                    <?php else : ?>
                    <td><?php echo (isset($row->$name) ? $row->$name : "")  ?></td>
                    <?php endif; ?>
                <?php endif; ?>
                <?php endforeach; ?>
        </tr>
        <?php endforeach; ?>
    <?php endif; ?>

</table>